import { createRouter, createWebHashHistory } from 'vue-router'

import Login from '@/views/Login/Login.vue'
import Layout from '@/views/Home/Layout.vue'
import Home from '@/views/Home/Home.vue'
import User from '@/views/User/User.vue'

const routes = [
  // 登录的路由规则
  { path: '/login', component: Login, name: 'login' },
  {
    path: '/',
    component: Layout,
    name: 'layout',
    children: [
      { path: '', component: Home, name: 'home' },
      { path: 'user', component: User, name: 'user' }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
